<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

class TRealdataPower extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('t_realdata_power', function (Blueprint $table) {
             $table->engine = 'MEMORY';
             $table->charset = 'utf8';
             $table->collation = 'utf8_general_ci';
            // CONTENT
            $table->datetime('rd_updatetime')->nullable(false)->comment('');
			$table->integer('pdi_index')->nullable(false)->default(0)->comment('');
			$table->float('rd_PhaVol_A', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_LinVol_CA', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_PhaCur_A', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_NA_A', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_ActPow_A', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_PowFac_A', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_ReaPow_A', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_AppPow_A', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_PhaVol_B', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_LinVol_AB', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_PhaCur_B', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_NA_B', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_ActPow_B', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_PowFac_B', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_ReaPow_B', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_AppPow_B', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_PhaVol_C', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_LinVol_BC', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_PhaCur_C', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_NA_C', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_ActPow_C', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_PowFac_C', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_ReaPow_C', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_AppPow_C', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_AvePhaVol', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_AveLinVol', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_AvePhaCur', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_Freq', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_ActPow_All', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_PowFac_All', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_ReaPow_All', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_AppPow_All', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_PosActEne', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_NegActEne', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_PosReaPow_All', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_NegReaPow_All', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_LocAddr', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_LoadMode', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_Baud', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_InputVolRan', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_PTValue', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_CTValue', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_LigInt', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_PhaOutload_A', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_PhaOutload_B', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_PhaOutload_C', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_PhaEne_A', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_PhaEne_B', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_PhaEne_C', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_AveLoad', 9, 2)->nullable()->default(0)->comment('');
			$table->boolean('rd_NetCom')->nullable()->default(0)->comment('');
			$table->unique('pdi_index', 'pdi_index');
			
        });

        
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('t_realdata_power');
    }
}
